#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
    string input;
    getline(cin, input);

    // 去除逗号并转换为字符数组
    string cleanInput = "";
    for (char c : input) {
        if (c != ',') {
            cleanInput += c;
        }
    }
    const char* chars = cleanInput.c_str();
    int car = 0;
    int length = cleanInput.length();

    for (int left = 0; left < length; left++) {
        // 如果是1，表示有车占用
        if (chars[left] == '1') {
            int right = left + 1;

            // 统计被连续占用的车位数量
            while (right < length && chars[right] == '1') {
                right++;
            }

            // 先用卡车来占车位，再用货车占车用，最后用小车来占车位
            int size = right - left;
            car += (size / 3);
            size %= 3;
            car += (size / 2);
            size %= 2;
            car += size;
            left = right;
        }
    }

    cout << car << endl;

    return 0;
}